﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace frmPrincipal
{
    public partial class frmConFornecedores : Form
    {
        private int callWidth;
        private int callHeight;

        public frmConFornecedores()
        {
            this.callWidth = 400;
            this.callHeight = 300;

            InitializeComponent();
        }

        //Chama os Respectivos Formulários
        private void btnSearchAll_Click(object sender, EventArgs e)
        {
            frmConsultaBasica consulta;
            string title = "Consulta de Todos os Fornecedores";
            string sqlCommandText;

            sqlCommandText = "SELECT * FROM fornecedor " +
                    "ORDER BY nome_forn";

            consulta = new frmConsultaBasica(title, sqlCommandText, callWidth, callHeight);
            consulta.Show();
        }
        private void btnSearchByName_Click(object sender, EventArgs e)
        {
            frmConPorNome consultaNome;

            consultaNome = new frmConPorNome("Nome do Fornecedor:", "Consulta de Fornecedores por Nome", "fornecedor", "nome_forn", callWidth, callHeight);
            consultaNome.Show();
        }
        private void btnSearchByCode_Click(object sender, EventArgs e)
        {
            frmConPorCodigo consultaCodigo;

            consultaCodigo = new frmConPorCodigo("CNPJ do Fornecedor:", "Consulta de Fornecedores por CNPJ", "fornecedor", "cnpj", callWidth, callHeight);
            consultaCodigo.Show();
        }
        private void btnEspecial_Click(object sender, EventArgs e)
        {
            frmInfoConsultas consultaEspecial = new frmInfoConsultas(frmInfoConsultas.Querys.MainSupplierByProduct, this.callWidth, this.callHeight);

            consultaEspecial.Show();
        }
        private void btnMaiorForn_Click(object sender, EventArgs e)
        {            
            frmInfoConsultas consulta = new frmInfoConsultas(frmInfoConsultas.Querys.MainSupplier, callWidth, callHeight);;
            consulta.Show();
        }
        private void btnMenosMedia_Click(object sender, EventArgs e)
        {
            frmInfoConsultas consulta = new frmInfoConsultas(frmInfoConsultas.Querys.SupplierByAverage, callWidth, callHeight);
            consulta.Show();
        }

        //Volta p/ frmConsultaPrincipal
        private void btnReturn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
